import axios from 'axios';
import {ALL_SERVICE_API} from '../api';

var qs = require('qs');

const STM_STMADVERTISEMENT_PICTURES = ALL_SERVICE_API + '/stm_advertisement_pictures';

const STM_STMADVERTISEMENT_PICTURE_BY_ID = ALL_SERVICE_API + '/stm_advertisement_picture/';

const STM_STMADVERTISEMENT_PICTURE_BY_ID1 = ALL_SERVICE_API + '/stm_advertisement_picture_detail/';

const STM_STMADVERTISEMENT_PICTURE_DETAILSS = ALL_SERVICE_API + '/stm_advertisement_picture_detailss';
const STM_STMADVERTISEMENT_PICTURE_DETAILS = ALL_SERVICE_API + '/stm_advertisement_picture_details';
const STM_STMADVERTISEMENT_PICTURE_DETAIL_CHANGE = ALL_SERVICE_API + '/stm_advertisement_picture_detail_change';
const STM_STMADVERTISEMENT_PICTURE_DETAILS_GET_ID = ALL_SERVICE_API + '/stm_advertisement_picture_details_get/';

// 获取列表
export const searchAdvertisementPictures = params => {
  return axios.get(STM_STMADVERTISEMENT_PICTURES, {params: params});
};
// 保存图片轮播
export const saveAdvertisementPicture = (params) => {
  return axios.put(STM_STMADVERTISEMENT_PICTURES, params);
};
// 删除图片轮播
export const delAdvertisementPicture = id => {
  return axios.delete(STM_STMADVERTISEMENT_PICTURE_BY_ID + id);
};
// 根据ID获取
export const getDetailById = params => {
  return axios.get(STM_STMADVERTISEMENT_PICTURE_DETAILSS, {params: params});
};
// 保存图片轮播
export const saveAdvertisementPictureDetail = (advertisementPictureDetail) => {
  return axios.post(STM_STMADVERTISEMENT_PICTURE_DETAILS, advertisementPictureDetail);
};
export const modifyStatus = (id, status) => {
  return axios.post(STM_STMADVERTISEMENT_PICTURE_DETAIL_CHANGE, qs.stringify({id: id, status: status}));
};
// 删除图片轮播
export const delAdvertisementPictureDetail = id => {
  return axios.delete(STM_STMADVERTISEMENT_PICTURE_BY_ID1 + id);
};
// 根据ID获取图片详情
export const getAdvertisementPictureById = id => {
  return axios.get(STM_STMADVERTISEMENT_PICTURE_DETAILS_GET_ID + id);
};
